function [coeftomin,xx,yy] = optimise_drift_toolbox(initparams,patient, ii,jj,kk);
%

bellows_volt_drifted=patient.bellows_volt+initparams*patient.scan_times_zerod;
bellows_volt_drifted(:,~ismember(1:patient.scans,patient.run_scans))=NaN;

[bellows_volt_drifted, flow_drifted] = calculate_volume_flow_fit_toolbox(bellows_volt_drifted, patient);

error = model5d_driftcorrection_toolbox(patient,bellows_volt_drifted, flow_drifted, ii,jj,kk);
error_mask = double(error.*patient.static_mask(:,jj,kk));
coeftomin = nansum(error_mask(:));  
